package com.yunhe.mybatis.web;

import com.yunhe.mybatis.entity.User;
import com.yunhe.mybatis.service.impl.UserServiceImpl;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;

@WebServlet("/login")
public class LoginServlet extends HttpServlet{
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        /*    try {

                if (null !=userName && null !=password && userName.trim().isEmpty() && password.trim().isEmpty()){
                throw  new Exception("用户名或者密码为空");
                }
                UserServiceImpl userService = new UserServiceImpl();
                List<User> all = userService.findAll();

            } catch (Exception e) {
                e.printStackTrace();
            }*/
resp.sendRedirect("/index.jsp");
       /* req.getRequestDispatcher("/index.jsp").forward(req,resp);*/
    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        doGet(req,resp);
    }
}
